test: isolate missing-env reporting state (Fixes #500) - #501
Conversation
Inject the atomic state into state-machine helpers so parallel configure tests cannot corrupt missing-env reporting tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Performance Report (Linux) ➖
Legend
|
Performance Report (macOS)
Legend
|
Test Coverage Report (Linux)
Coverage unchanged. |
Performance Report (Windows) ➖
Legend
|
Test Coverage Report (Windows)
Coverage decreased. Please add tests for new code. |
There was a problem hiding this comment.
🟢 Ready to approve
The changes align with the issue acceptance criteria and cleanly isolate test state while preserving production behavior via wrappers over the existing global atomic.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR reduces test flakiness around missing-environment reporting in pet::jsonrpc by extracting the missing-env reporting state-machine helpers to accept an injected AtomicU64, while keeping production behavior backed by the existing process-global atomic. Tests are updated to use per-test local atomics, removing the need for a shared test mutex and preventing cross-test interference with configure-related state changes.
Changes:
- Added
*_with_statevariants for missing-env reporting helpers that accept an injected&AtomicU64, with thin production wrappers continuing to useMISSING_ENVS_REPORTING_STATE. - Removed the global
MISSING_ENVS_TEST_LOCKand updated missing-env-reporting unit tests to use independent localAtomicU64instances. - Adjusted the configure-reset test to validate the reset behavior using the injected state rather than process-global state.
File summaries
| File | Description |
|---|---|
| crates/pet/src/jsonrpc.rs | Extracts missing-env reporting state-machine helpers to accept injected atomics and updates unit tests to avoid shared process-global state. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Summary
Validation
cargo test -p pet --bin pet --quietruns.\scripts\rust-precommit.ps1Fixes #500